ShowTable of Contents
Overview
To create a JAX-WS client, the following steps can be completed:
1. Create the JAX-WS web service.
2. Create the JAX-WS client.
3. Deploy client code to an Expeditor client.
Download Source Code
Create the JAX-WS web service
Using Rational Application Developer (RAD), create a web service that will simply respond with date information to the caller.
Create a class file with the following contents.
package com.ibm.rcp.support.ws.remote;
import java.util.Calendar;
public class RemoteSystem {
public String getSystemTime(){
return Calendar.getInstance().getTime().toString();
}
}
To generate a web service on the above bean, simply:
- Right mouse click the class file in the package navigator.
- Select Web Services -> Create Web Service.
- Select the "IBM WebSphere JAX-WS" web service runtime.
- Select the corresponding WebSphere Application server runtime.
- Complete the wizard using default values.
- Export the EAR project as an EAR.
- Install the enterprise application EAR in the WebSphere Application Server.
You should now be able to validate that a Web Service can be found at the following URL:
http://<your_was_server>:<port>/com.ibm.rcp.support.ws.remote/services/RemoteSystem
Create the JAX-WS client
Again in RAD, create the client code by completing:
- Create a Client Services Project.
- Locate the WSDL file within the Web Service project; usually in WEB-INF/wsdl.
- Copy the WSDL file into the Client Services project.
- Update the WSDL files, "wsdlsoap:address location" to reference your WebSphere server.
- Right mouse click the WSDL file and select Generate Client.
- Select the JAX-WS web service runtime.
- Select the WebSphere Application Server v7.0 server.
- Complete the wizard using default values.
Note that even though you selected the WebSphere runtime, deploying to Lotus Expeditor is possible.
Deploy client code to an Expeditor client
Given we have a simple skeleton, you will likely need to do additional development. When importing the project into Eclipse, you will notice an error in the project.
This is due to a RAD variable. Simply remove the WAS_V7JAXWS_WEBSERVICES_THINCLIENT variable.
If you intend on using the variable and corresponding library, ensure that the JAR is either deployed to Expeditor as a plugin or contained within the JAX-WS Client Services plugin.
Next update the Activator class to test the plugin.
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
RemoteSystemProxy proxy = new RemoteSystemProxy();
System.out.println(proxy.getSystemTime());
}